package com.mabang.medata.procotol;

import com.mabang.medata.model.Quote;

/**
 * 
 * @ClassName: QuoteProcotol
 * @Description: 报价单协议部分
 * @author yuyidi
 * @date 2015年4月1日 上午11:34:27
 */
public class QuoteProcotol {
	/**
	 * 
	 * @Title: quoteNo
	 * @Description: 报价单查询报文
	 * @Param quotoNo[报价单号]
	 * @return String
	 * @throws
	 */
	public static String quoteNo(String quoteNo) {
		StringBuffer buffer = new StringBuffer();
		buffer.append("<proposal valid=\"true\">");
		buffer.append("<quote-no>#quoteno#</quote-no>");// 报价单号
		buffer.append("</proposal>");
		String result = buffer.toString();
		result = result.replace("#quoteno#", quoteNo);
		return result;
	}

	/**
	 * 
	 * @Title: responseQuoteNo
	 * @Description: 报价单查询返回报文
	 * @Param Quoto[报价单实体]
	 * @return String
	 * @throws
	 */
	public static String responseQuoteNo(Quote quote) {
		StringBuffer buffer = new StringBuffer();
		buffer.append("<new-quote-return-result status=\"#status#\">");
		buffer.append("<quote-no>#quoteNo#</quote-no>");
		buffer.append("<policy-name>#policyName#</policy-name>");
		buffer.append("<industry-type>#industryType#</industry-type>");
		buffer.append("<assureds-rate>#assuredsRate#</assureds-rate>");
		buffer.append("<amount-free>#amountFree#</amount-free>");
		buffer.append("<rate-free>#rateFree#</rate-free>");
		buffer.append("<trans-date>#transDate#</trans-date>");
		buffer.append("<message>#message#</message>");
		buffer.append("</new-quote-return-result>");
		String result = buffer.toString();
		result = result.replace("#status#", quote.getStatus());
		result = result.replace("#quoteNo#", quote.getCoverInsuranceCode());
		result = result.replace("#policyName#", quote.getPolicyName());
		result = result.replace("#industryType#", quote.getIndustryType());
		result = result.replace("#assuredsRate#", quote.getAssuredsRate());
		result = result.replace("#amountFree#", quote.getAmountFree());
		result = result.replace("#rateFree#", quote.getRateFree());
		result = result.replace("#transDate#", quote.getTransDate());
		result = result.replace("#message#", quote.getMessage());
		return result;
	}

	public static String execptionGetQuoteNo(String message, String date) {
		StringBuffer buffer = new StringBuffer();
		buffer.append("<execption-quote-return-result>");
		buffer.append("<trans-date>#transDate#</trans-date>");
		buffer.append("<message>#message#</message>");
		buffer.append("</execption-quote-return-result>");
		String result = buffer.toString();
		result = result.replace("#transDate#", date);
		result = result.replace("#message#", message);
		return result;
	}
}
